package com.kwz.common.collections;

import java.util.Iterator;

import com.kwz.common.CommonException;
import com.kwz.common.designpatterns.UnknownObject;

/**
 * <p>
 *              Visiteur de base sur un arbre
 * </p> 
 *
 * @author Cyril Chevalier
 * @since 1.11
 */
public abstract class BaseTreeVisitor extends UnknownObject implements ITreeVisitor {

    /**
     * 
     */
    public BaseTreeVisitor() {
    }

    // ------------------------ ITreeVisitor -------------------
    /* (non-Javadoc)
     * @see com.aca.common.collections.ITreeVisitor#visitChildren(com.aca.common.collections.ITreeNode)
     */
    public void visitChildren(ITreeNode node) throws CommonException {
        Iterator it = node.getChildrenNodes().iterator();
        while (it.hasNext()){
            visitNode((ITreeNode)it.next());
        }
    }

    /* (non-Javadoc)
     * @see com.aca.common.collections.ITreeVisitor#visitNode(com.aca.common.collections.ITreeNode)
     */
    public abstract void visitNode(ITreeNode node) throws CommonException;

}
